import { defineStore } from 'pinia'
import { resetRouter } from '@/router'
import { usePermissionStore } from './permission'

const store = () => {
    return {
        token: JSON.parse(sessionStorage.getItem('token')),
        user: JSON.parse(sessionStorage.getItem('user')),
        roles: JSON.parse(sessionStorage.getItem('roles')),
        permissions: JSON.parse(sessionStorage.getItem('permissions')),
    }
}

export const useUserStore = defineStore({
    id: 'user',
    store,
    actions: {
        login(data) {

        },
        GetUserInfo() {
            return new Promise((resolve, reject) => {
                resolve(this.roles)
            })
        }
    }
})
